function shuffle(a) { var j, x, i; for (i = a.length - 1; i > 0; i--) { j = Math.floor(Math.random() * (i + 1)); x = a[i]; a[i] = a[j]; a[j] = x; } } function average(a){ var sum = 0; for(i = 0;i0.5){ toFront(obj); }else{ toBack(obj); } } setTimeout(function(){ for(i=0;i